<?php 
defined('JPATH_BASE') or die;

class JFormFieldCategory extends JFormField{
	protected $type='Category';
	protected function getInput(){
		//Cac thuoc tinh xml
		//JError::raiseWarning(100, 'category.php');
		if($this->element['size'])
			$attr =' size="'.(int)$this->element['size'].'"';
		else
			$attr='';
		
		//Truy van bang category
		$db = &JFactory::getDbo();
		$query = 'SELECT id AS value, name AS text FROM aas_app_category';
		$db->setQuery($query);
		
		//Tao combobox
		return JHtml::_('select.genericlist',
						$db->loadObjectList(),
						$this->name, trim($attr));
		
	}
}